﻿using System;

namespace WebRole1
{
	public partial class About : System.Web.UI.Page
	{
		protected override void OnLoad(EventArgs e)
		{
			if (! IsPostBack )
				BindValues ();
		}

		private void BindValues ()
		{
			var cloudStorage = new CloudStorage ();
			BlobRepeater.DataSource = cloudStorage.GetAllPrivateBlobs ( );
			BlobRepeater.DataBind();
		}

		protected void Clear_Click(object sender, EventArgs e)
		{
			var cloudStorage = new CloudStorage();
			cloudStorage.ClearPrivateStorage ();
			cloudStorage.ClearPublicStorage ();
		}

		protected void Save_Click(object sender, EventArgs e)
		{
			var cloudStorage = new CloudStorage();
			if ( permission.Checked )
				cloudStorage.AddPublicFile ( flUpload.FileName , flUpload.FileContent );
			else
				cloudStorage.AddPrivateFile ( flUpload.FileName , flUpload.FileContent );

			BindValues();
		}
	}
}
